# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>

pkgbase=spandsp
pkgname=(spandsp spandsp-docs)
pkgver=0.0.6
pkgrel=5
pkgdesc='Low-level signal processing library that modulates and demodulates signals commonly used in telephony'
arch=('loong64' 'x86_64')
url='https://www.soft-switch.org/'
license=('LGPL2.1')
depends=('glibc' 'libtiff')
makedepends=('docbook-xsl' 'doxygen')
source=("https://www.soft-switch.org/downloads/$pkgbase/$pkgbase-$pkgver.tar.gz")
sha256sums=('cc053ac67e8ac4bb992f258fd94f275a7872df959f6a87763965feabfdcc9465')

build() {
  cd $pkgbase-$pkgver
  ./configure --prefix=/usr --enable-doc
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package_spandsp() {
  cd $pkgbase-$pkgver
  make DESTDIR="$pkgdir" install
}

package_spandsp-docs() {
  pkgdesc='Developer documentation for spandsp'
  depends=()

  cd $pkgbase-$pkgver
  install -dm755 "$pkgdir/usr/share/doc/$pkgbase"
  cp -r doc/api/html "$pkgdir/usr/share/doc/$pkgbase/"
}
